package com.chenjun.common;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Properties;

import com.chenjun.common.util.ConfigUtil;

/**
 * @Title: Constant 
 * @Description: 系统常量
 * @author Sean
 * @date 2016年7月7日 下午3:42:07 
 * @version V1.0
 */
public final class Constant {
	
	private Constant(){}
	
	public static final String MONTHREPORT_LEAVE_HOURS = "leaveHours"; // 请假时长
	/*public static final String MONTHREPORT_RITE_LEAVE_HOURS = "riteLeaveHours"; // 喜丧假时长
	public static final String MONTHREPORT_YEAR_LEAVE_HOURS = "yearLeaveHours"; // 年休假时长
	public static final String MONTHREPORT_SICK_LEAVE_HOURS = "sickLeaveHours"; // 病假时长
	public static final String MONTHREPORT_AFFAIRS_LEAVE_HOURS = "affairsLeaveHours"; // 事假时长
	public static final String MONTHREPORT_PAID_LEAVE_HOURS = "paidLeaveHours"; // 调休时长
	public static final String MONTHREPORT_INDUCTRIALINJURYHOURS = "inductrialInjuryHours"; // 工伤时长
	*/	
	
	public static final String MONTHREPORT_OVERTIME_HOURS = "overtimeHours"; // 加班时长
	public static final String MONTHREPORT_ATTENDANCE_DAYS = "attendanceDays"; // 月报key,出勤天数
	public static final String MONTHREPORT_ATTENDANCE_HOURS = "attendanceHours"; // 月报key，出勤小时数
	public static final String MONTHREPORT_HOLIDAYOVERTIME_HOURS = "holidayOvertimeHours"; // 法定节假日加班时长
	
	/**
	 * 工时制ID
	 */
	public static final int STANDARD_HOURS_TYPE=1; // 标准工时制ID
	public static final int NONSTANDARD_HOURS_TYPE=2; // 标准工时制ID
	public static final int INTEGRATED_HOURS_TYPE=3; // 综合工时制ID
	
	/**
	 * 考勤
	 */
	public static final int ATTENDANCE_STYLE_FINGERPRINT=1; // 指纹设备考勤
	public static final int ATTENDANCE_STYLE_PHONE_GPS=2; // 手机考勤_GPS
	public static final int ATTENDANCE_STYLE_PHONE_STATION=3; // 手机考勤_基站
	public static final int ATTENDANCE_STYLE_PHONE_GPS_STATION=4; // 手机考勤_GPS+基站
	public static final int ATTENDANCE_STYLE_PHONE_NONE=5; // 手机考勤_不定位
	public static final int ATTENDANCE_STYLE_ARTIFICIAL=6; // 人工补录
	
	
	/**
	 * 申请状态码
	 */
	public static final int APPLY_PENDING_SUBMIT=10; // 待提交
	public static final int APPLY_PENDING_REVIEW=20; // 待审核
	public static final int APPLY_REVIEWING=30; // 审核中
	public static final int APPLY_PASS=40; // 已同意
	public static final int APPLY_REJECT=50; // 已驳回
	
	/**
	 * 默认状态
	 */
	public static final int STATUS_TRUE= 1; // 已驳回
	public static final int STATUS_FALSE=0; // 已驳回
	
	/**
	 * 用户报名活动的状态码
	 */
	public static final int JOIN_ACTIVITY_STATUS_NOJOIN=0;//没有报名过
	public static final int JOIN_ACTIVITY_STATUS_EXAMING=1;//审核中
	public static final int JOIN_ACTIVITY_STATUS_IN=2;//已经进群 、已经是好友
	public static final int JOIN_ACTIVITY_STATUS_REFUSE=3;//被拒绝了
	/**
	 * 用户app在线状态
	 */
	public static final String RELOGIN="登陆超时，请重新登陆";
	public static final String LOGIN_OUT_SUCCESS="已退出";
	public static final String LOGIN_SUCCESS="登陆成功";
	public static final String LOGIN_FAIL="登陆失败,账户名或密码错误";
	
	/**
	 * 规则定义表等级
	 */
	public static final String RULE_LEVEL_EXCELLENT="0";//优秀
	public static final String RULE_LEVEL_GOOD="1";//良好
	public static final String RULE_LEVEL_PASS="2";//及格
	public static final String RULE_LEVEL_BAD="3";//不及格
	
	/**
	 * 体重规则定义表等级
	 */
	public static final String RULE_LEVEL_NORMAL="0";//正常
	public static final String RULE_LEVEL_THIN="1";//低体重
	public static final String RULE_LEVEL_OVERWEIGHT="2";//超重
	public static final String RULE_LEVEL_FAT="3";//肥胖
	
	
	/**
	 * 商品状态
	 */
	public static final String PRODUCT_STATUS_HOTSELL="0";//热卖
	public static final String PRODUCT_STATUS_WAITCHECK="1";//待审核
	public static final String PRODUCT_STATUS_UNPASS="2";//审核未过
	public static final String PRODUCT_STATUS_UNSALE="3";//下架
	public static final String PRODUCT_STATUS_ORDERED="4";//已下单,未结算
	
	/**
	 * 订单状态
	 */
	public static final String ORDER_STATUS_UNPAID="0";//待付款
	public static final String ORDER_STATUS_PAID="1";//已付款
	public static final String ORDER_STATUS_CANCEL="2";//取消
	public static final String ORDER_STATUS_COMPLETED="3";//已完成
	
	/**
	 * 规则表Type(是否有附加分)
	 */
	public static final String RULE_TYPE_EXTRA="EXTRA";//有附加分
	public static final String RULE_TYPE_NOEXTRA="NOEXTRA";//无附加分
	
	/**
	 * 语言
	 */
	public static final String LANGUAGE_EN="en";
	public static final String LANGUAGE_CN="cn";
	/**
	 * 个推信息code和message内容
	 */
	public static final String  NOTIFICATION_OFFLINE="notificationoffline";
	protected static HashMap<String, String> pushMessage_en=new HashMap<String, String>(1);
	protected static HashMap<String, String> pushMessage_cn=new HashMap<String, String>(1);
	static{
		pushMessage_en.put(NOTIFICATION_OFFLINE, "");
		pushMessage_cn.put(NOTIFICATION_OFFLINE, "");
	}
	

	public static final String RESCOURCE_TOP_FID = "-1";
	public static String version = null;


	public static String ENABLED = "1";
	public static String DISABLED = "0";
	
	static {
		
		version = ConfigUtil.getValue(null, "project.build.version");
		if (version == null || (version.startsWith("${") && version.endsWith("}"))) {
			version = "0000";
		}
		
	}
	
	/**
	 * @Title: Session 
	 * @Description: 会话常量定义
	 * @author Sean
	 * @date 2016年7月7日 下午3:46:27 
	 * @version V1.0
	 */
	public static enum Session{
		
		USER("session_user"),
		USER_ROLE("session_user_role"),
		SLIDER_MENU("session_slider_menu"),
		LOCALE_CONTEXT("session_locale"),
		CAMPUS("campus"),
		UNIVERSITY("university");
		private String value;

		Session(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.value;
		}
	}
	/**
	 * 群聊设置选项
	 * @Title: ChatGroupConfig 
	 * @Description: TODO
	 * @author wayne
	 * @date 2016年12月3日 下午4:11:19 
	 * @version V1.0
	 */
public static enum ChatGroupConfig{
		
		CONFIG_APPLY("capply"),
		CONFIG_MEMBER_ADD("cmemberAdd"),
		CONFIG_NICKNAME("cnickname"),
		CONFIG_EXAM("cexam");
		private String value;

		ChatGroupConfig(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.value;
		}
	}
	
	
	/**
	 * 
	 * @Title: Tree 
	 * @Description: 树形菜单
	 * @author Sean
	 * @date 2016年7月7日 下午3:47:42 
	 * @version V1.0
	 */
	public static enum Tree{
		
		FILE_TYPE("file"),
		STATE_DISABLED("disabled"),
		TOP_FID("0"),
		RESCOURCE_TOP_FID("-1");
		
		private String value;

		Tree(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.value;
		}
	}
	
	/**
	 * @Title: State 
	 * @Description: 系统状态
	 * @author Sean
	 * @date 2016年7月7日 下午4:39:09 
	 * @version V1.0
	 */
	public static enum State{
		
		ENABLED("0"),
		DISABLED("1");
		
		private String value;

		State(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.value;
		}
	}

	
	
	/**
	 * @Title: Dictionary 
	 * @Description: 字典管理
	 * @author Sean
	 * @date 2016年7月13日 上午11:17:41 
	 * @version V1.0
	 */
	public static enum Dictionary{
		
		SYS_TYPE("系统配置","SYS_TYPE"),//系统配置
		CLASSIFY_TYPE("电梯分类配置","CLASSIFY_TYPE"),//电梯分类配置
		USEPLACE_TYPE("场所配置","USEPLACE_TYPE"),//场所配置
		INSURE_TYPE("保险公司配置","INSURE_TYPE");//保险公司配置
		   
		private String value;
		private String name;

		Dictionary(String name,String value) {
			this.name  = name;
			this.value = value;
		}
		
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}

		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}

		@Override
		public String toString() {
			return this.value;
		}
		
	}
	
	public static enum AppLoginType{
		PARENT("0"),
		TEACHER("2"),
		STUDENT("1");
		private String value;

		AppLoginType(String value) {
			this.value = value;
		}

		@Override
		public String toString() {
			return this.value;
		}
	}
	/**
	 * 肺活量(单位:毫升)
	 */
	public static final String CAPACITY="0";
	/**
	 * 50米跑(单位:秒)
	 */
	public static final String MILE50="1";
	/**
	 * 坐位体前屈(单位：厘米)
	 */
	public static final String STANDINGPRONENESS="2";
	/**
	 * 立定跳远(单位：厘米)
	 */
	public static final String STANDINGJUMP="3";
	/**
	 * 引体向上评分表(单位：次)
	 */
	public static final String PULLUPS="4";
	/**
	 * 耐力跑(1000m)评分表(单位:秒)
	 */
	public static final String MILE1000="5";
	/**
	 * 一分钟仰卧起坐评分表(单位：次)
	 */
	public static final String ABDOMINALCURL="6";
	/**
	 * 800m评分表(单位:秒)
	 */
	public static final String MILE800="7";
	/**
	 * 体重指数(BMI)单项评分(单位：千克/米2)
	 */
	public static final String BMI="8";
	
	
	/**
	 * 是否有附加分type
	 */
	public static final String NOEXTRA="NOEXTRA";
	public static final String EXTRA="EXTRA";
	
	/**
	 * 男女性别
	 */
	public static final String SEX_MALE="1";
	public static final String SEX_FMALE="2";
	
	/**
	 * BMI level体重相关
	 */
	public static final String NORMAL="正常";
	public static final String OVERWEIGHT="超重";
	public static final String LOWWEIGHT="低体重";
	public static final String FAT="肥胖";
	/**
	 * 其他level
	 */
	public static final String EXCELLENT="优秀";
	public static final String GOOD="良好";
	public static final String PASS="及格";
	public static final String NOPASS="不及格";
	
	
	
	/**
	 * resultDto errorCode start
	 */
	//token值错误，通知退出
	public static final int CODE_1001=1001;
	
	/**
	 * resultDto errorCode end
	 */
	
	public static final String IS_DEL_0 = "0";
	public static final String IS_DEL_1 = "1";

	public static final String PATH_EXCEL = ConfigUtil.getValue("","upload.path.excel");
	
	//图片上传请求服务器地址
		public static String FILESERVER_HOST = "";
		public static String FILESERVER_ROOT = "";
		//FTP文件服务器
		public static String FTP_SERVER_HOST = "";
		public static int FTP_SERVER_PORT = 21;
		public static String FTP_SERVER_NAME = "";
		public static String FTP_SERVER_PASSWORD = "";
		public static String FTP_SERVER_ROOT = "";
		public static String FTP_PHYSICAL_ROOT = "";

		static {
			try {
				InputStream resourceAsStream = Constant.class.getClassLoader().getResourceAsStream("constant.properties");
				Properties properties = new Properties();
				properties.load(resourceAsStream);
				//图片上传请求服务器地址
				FILESERVER_HOST = properties.getProperty("FILESERVER_HOST");
				FILESERVER_ROOT = properties.getProperty("FILESERVER_ROOT");
				//FTP文件服务器
				FTP_SERVER_HOST = properties.getProperty("FTP_SERVER_HOST");
				FTP_SERVER_PORT = Integer.valueOf(properties.getProperty("FTP_SERVER_PORT"));
				FTP_SERVER_NAME = properties.getProperty("FTP_SERVER_NAME");
				FTP_SERVER_PASSWORD = properties.getProperty("FTP_SERVER_PASSWORD");
				FTP_SERVER_ROOT = properties.getProperty("FTP_SERVER_ROOT");
				FTP_PHYSICAL_ROOT = properties.getProperty("FTP_PHYSICAL_ROOT");
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
}
